package com.imufe.chemicalenterprisedangerwarning.entity.query;

import com.imufe.chemicalenterprisedangerwarning.annotation.ExistId;
import com.imufe.chemicalenterprisedangerwarning.mapper.EnterpriseMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * @author BaiBan
 * @since 2022/10/6
 */

@Data
@ApiModel("检查单元请求")
public class CheckUnitQuery {
    @ApiModelProperty("模块编号")
    @Null(message = "创建时模块编号不能填", groups = CreateGroup.class)
    @NotNull(message = "修改时模块编号必须填", groups = UpdateGroup.class)
    private Long id;

    @ApiModelProperty("模块名")
    @NotNull(message = "修改时模块名必须填", groups = UpdateGroup.class)
    private String name;

    @ApiModelProperty("权重, 一个企业的模块权重和不能超过100")
    @Min(message = "权重不能小于0, 也不能大于100", value = 1, groups = CreateGroup.class)
    @Max(message = "权重不能小于0, 也不能大于100", value = 100, groups = CreateGroup.class)
    private Integer weight;

    @ApiModelProperty("排序, 默认0")
    private Integer sort;

    @ApiModelProperty("企业编号")
    @ExistId(message = "企业不存在，请选择正确的企业", groups = CreateGroup.class, value = EnterpriseMapper.class)
    @Null(message = "修改时企业编号不填", groups = UpdateGroup.class)
    private Long enterpriseId;
}